namespace Sharpmark.PerfectLife.ColorfulPhotos.TextualPhoto.SubFunctionForm
{
    using System;
    using System.Drawing;
    using System.Windows.Forms;

    public partial class FrmThumbnailView : Form
    {
        private Image _image;
        public FrmThumbnailView(string filename)
        {
            _image = Bitmap.FromFile(filename);

            InitializeComponent();

            BindImage();
        }

        public FrmThumbnailView(Image image)
        {
            InitializeComponent();

            _image = image;
        }

        private void FrmThumbnailView_Paint(object sender, PaintEventArgs e)
        {
            // BindImage();
        }

        private void BindImage()
        {
            this.pcbThumbnailViewer.Image = _image.GetThumbnailImage(
                this.pcbThumbnailViewer.Width,
                this.pcbThumbnailViewer.Height,
                null, IntPtr.Zero);
        }

        private void FrmThumbnailView_Resize(object sender, EventArgs e)
        {
            BindImage();
        }

        private void FrmThumbnailView_Load(object sender, EventArgs e)
        {
            BindImage();
        }
    }
}